package com.marktotop.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.marktotop.entity.Employee;
import com.marktotop.entity.Log;
import com.marktotop.mapper.LogMapper;
import com.marktotop.response.ResultBean;
import com.marktotop.response.ResultCode;
import com.marktotop.service.ILogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * LogServiceImpl
 *
 * @author WXLD
 * @Data 2021/7/1
 * @Since 1.0
 */
@Service
//public class LogServiceImpl extends ServiceImpl<LogMapper, Log> implements ILogService {
public class LogServiceImpl{
    @Autowired
    private LogMapper logMapper;


//    @Override
    public ResultBean findLogList(Integer currentPage, Integer size, Log log) {
        // 开启分页
        Page<Log> page = new Page<>(currentPage,size);
        IPage<Log> logByPage = logMapper.getLogByPage(page, log);
        if (null == logByPage){
            return ResultBean.result(ResultCode.NON_RESULT);
        }
        return ResultBean.ok().message("获取全部日志信息成功！")
                .data("total",logByPage.getTotal())
                .data("logs",logByPage.getRecords());
    }
}
